home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Game / Thing / CShotPatriot.as < prev    next >
Encoding:
Text File  |  2011-08-19  |  4.8 KB  |  185 lines

  1.  
  2. {
  3.    if(true)
  4.    {
  5.       CShotPatriot = ┬º┬ºnewclass(CShotPatriot,CShot);
  6.    }
  7. }
  8.  
  9. package Local.Game.Thing
  10. {
  11.    import Local.Game.World.*;
  12.    import Local.Game.World.Map.*;
  13.    import Local.Game.World.Map.Cell.*;
  14.    import Local.Math.*;
  15.    import STC9.System.*;
  16.    import flash.display.*;
  17.    import flash.events.*;
  18.    import flash.geom.*;
  19.    
  20.    public class CShotPatriot extends CShot
  21.    {
  22.        
  23.       
  24.       private var mPath:CPath;
  25.       
  26.       private var mFlare:CThingAnimation;
  27.       
  28.       public function CShotPatriot(param1:CPosition)
  29.       {
  30.          param1.x = -400;
  31.          param1.y = 100;
  32.          super(param1);
  33.          mType = "patriot";
  34.          Process = Process_Normal;
  35.          mAngle = new CAngle();
  36.          mDelta = new CPosition();
  37.          mMaxLife = mLife = 100;
  38.          mMaxSpeed = 250 * mSpriteScalar;
  39.          mSpeed = 0;
  40.          mAcceleration = 10;
  41.          mOrientation = 1;
  42.          mShowOnMap = true;
  43.          SetTargetting(600,true,FILTER_AirTargets,false);
  44.          AddAnimation("stand",Patriot,"AddSprite_Black");
  45.          SetCollisionBySprite(mAnimation[0]);
  46.          AddThing(mFlare = new CThingAnimation(Patriot_Flare,"AddSprite_Scale"));
  47.          SetState("SEARCHTARGET");
  48.          IncrementFired();
  49.       }
  50.       
  51.       public function State_SEARCHTARGET_Exit() : void
  52.       {
  53.       }
  54.       
  55.       public function State_SEARCHTARGET() : void
  56.       {
  57.          mDelta = CPosition.NORMALIZE(mAngle.mDelta,mSpeed);
  58.          mPosition.Add(mDelta);
  59.          if((mCurrentTarget = GetTarget()) != null)
  60.          {
  61.             SetState("FOLLOWPATH");
  62.             return;
  63.          }
  64.       }
  65.       
  66.       public function State_FOLLOWPATH_Enter() : void
  67.       {
  68.          mPath = new CPath();
  69.          mPath.SetPath([mPosition,new Point((mPosition.x + mCurrentTarget.mPosition.x) / 2,mPosition.y),mCurrentTarget.mPosition]);
  70.          mPath.OrientateThing(this);
  71.       }
  72.       
  73.       public function State_FOLLOWPATH_Exit() : void
  74.       {
  75.       }
  76.       
  77.       public function State_SEARCHTARGET_Enter() : void
  78.       {
  79.       }
  80.       
  81.       public function State_NOPATH() : void
  82.       {
  83.          mDelta = CPosition.NORMALIZE(mAngle.mDelta,mSpeed);
  84.          mPosition.Add(mDelta);
  85.       }
  86.       
  87.       public function CreateExplosion() : void
  88.       {
  89.          Explode();
  90.          AddThing(new CEffectExplosionLarge(mPosition,150));
  91.          DispatchDispose();
  92.       }
  93.       
  94.       override public function Draw() : void
  95.       {
  96.          var _loc1_:Matrix = null;
  97.          var _loc2_:Point = null;
  98.          if(true)
  99.          {
  100.             super.Draw();
  101.             DrawTrail(4,150);
  102.          }
  103.          _loc1_ = GetOrientationMatrix();
  104.          DrawSprite(_loc1_);
  105.          _loc2_ = _loc1_.transformPoint(mSprite.mObjects["flare"].mPosition);
  106.          mFlare.mPosition.SetXY(_loc2_.x + mPosition.x,_loc2_.y + mPosition.y);
  107.          mFlare.mAngle.Copy(mAngle);
  108.          mFlare.Draw();
  109.       }
  110.       
  111.       public function Process_Normal() : void
  112.       {
  113.          var _loc1_:Point = null;
  114.          Accelerate_Speed();
  115.          if(Process_State != null)
  116.          {
  117.             Process_State();
  118.          }
  119.          if(mDisposed)
  120.          {
  121.             return;
  122.          }
  123.          mCollide.Update();
  124.          if(MapMoveTrail())
  125.          {
  126.             if(Process_ReachedObjective())
  127.             {
  128.                return;
  129.             }
  130.          }
  131.          Process_Children();
  132.          _loc1_ = OrientatePoint(mSprite.mObjects["payload"].mPosition.clone(),mPosition);
  133.          if(_loc1_.y >= mLandscape.GetAltitude(_loc1_.x))
  134.          {
  135.             mPosition.SetXY(_loc1_.x,mLandscape.GetAltitude(_loc1_.x));
  136.             CreateExplosion();
  137.          }
  138.          if(mDead)
  139.          {
  140.             DispatchDispose();
  141.          }
  142.       }
  143.       
  144.       public function State_NOPATH_Exit() : void
  145.       {
  146.       }
  147.       
  148.       public function State_NOPATH_Enter() : void
  149.       {
  150.       }
  151.       
  152.       public function State_FOLLOWPATH() : void
  153.       {
  154.          if(true)
  155.          {
  156.             if(!mPath.MoveAlong(mSpeed))
  157.             {
  158.                if(true)
  159.                {
  160.                   SetState("NOPATH");
  161.                   if(true)
  162.                   {
  163.                      Process_State();
  164.                      if(true)
  165.                      {
  166.                         return;
  167.                      }
  168.                      addr34:
  169.                      mPath.OrientateThing(this);
  170.                   }
  171.                   if(Math.abs(mCurrentTarget.mPosition.x - mPosition.x) <= mSpeed / 2)
  172.                   {
  173.                   }
  174.                   ┬º┬ºgoto(addr58);
  175.                }
  176.                CreateExplosion();
  177.                ┬º┬ºgoto(addr58);
  178.             }
  179.             ┬º┬ºgoto(addr34);
  180.          }
  181.          addr58:
  182.       }
  183.    }
  184. }
  185.